Skip to content

feat(git): support includeIf conditional config directives#296

Merged
skevetter merged 1 commit into
mainfrom
6004-git-includeif
May 15, 2026
Merged

feat(git): support includeIf conditional config directives#296
skevetter merged 1 commit into
mainfrom
6004-git-includeif

Conversation

@skevetter

Copy link
Copy Markdown
Contributor

Summary

  • Thread a workingDir parameter through GetUser(), ExtractGitConfiguration(), and addGitSSHSigningKey() so git config commands run in the workspace directory where includeIf "gitdir:..." directives are evaluated correctly
  • When workingDir is non-empty, the --global flag is omitted and cmd.Dir is set instead, letting git resolve the full config chain including conditional includes; when empty, previous --global behavior is preserved
  • Add unit tests covering includeIf resolution, global fallback, and non-matching includeIf patterns for both GetUser and ExtractGitConfiguration

Spec alignment

The devcontainer specification does not prescribe how git configuration should be resolved or forwarded — this is left to implementors. VS Code's reference implementation copies the host .gitconfig file into the container, which means includeIf directives are preserved in the file but won't match inside the container (different paths).

Devsy's approach is different and arguably more correct: it resolves git config values on the host — where includeIf "gitdir:..." patterns can match the actual workspace path — then forwards the resolved values (user.name, user.email, user.signingkey, gpg.format) into the container. This ensures users with multiple git identities (e.g., personal vs. work repos) get the correct identity applied without any container-side path gymnastics.

No deviations from spec: since the spec is silent on this topic, this implementation is fully compatible. The approach is strictly better than file-copying because it correctly evaluates conditional includes in their intended context.

Closes devpod#750

…ry context

Thread a workingDir parameter through GetUser(), ExtractGitConfiguration(),
and addGitSSHSigningKey() so that git config commands run in the workspace
directory where includeIf "gitdir:..." directives are evaluated correctly.

When workingDir is non-empty the --global flag is omitted and cmd.Dir is
set instead, letting git resolve the full config chain including conditional
includes. When workingDir is empty the previous --global behaviour is
preserved, so callers without workspace context (e.g. initial setup) are
unaffected.

Closes devpod#750
@netlify

netlify Bot commented May 14, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 79910b2
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a065bbbca7bf000086166e3

@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@skevetter has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 58 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48b7b379-3ce3-4cca-a176-f6455bc21d06

📥 Commits

Reviewing files that changed from the base of the PR and between 2d4b112 and 79910b2.

📒 Files selected for processing (9)
  • cmd/agent/container/credentials_server.go
  • pkg/agent/tunnelserver/tunnelserver.go
  • pkg/devcontainer/setup/setup.go
  • pkg/gitcredentials/gitcredentials.go
  • pkg/gitcredentials/gitcredentials_test.go
  • pkg/gitsshsigning/utils.go
  • pkg/gitsshsigning/utils_test.go
  • pkg/tunnel/services.go
  • pkg/tunnel/services_test.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@skevetter
skevetter marked this pull request as ready for review May 14, 2026 23:52
@skevetter
skevetter enabled auto-merge (squash) May 14, 2026 23:53
@skevetter
skevetter merged commit 6ef0418 into main May 15, 2026
57 checks passed
@skevetter
skevetter deleted the 6004-git-includeif branch May 15, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant